<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function initDiv()
			{
				var d=document.getElementsByTagName("div");
				for(var i in d)
				{
					//d[i].onclick=callme;
					d[i].onclick=function(){
						alert("这是一个div");
					}
				}
			}
			function callme()
			{
				alert("this is div");
			}
		</script>
	</head>
	<body onload="initDiv()">
		<div>
			1
		</div>
		<div>2</div>
	</body>
</html>
